package cuShapes;

import java.awt.Color;
import xml.*;
import java.awt.Graphics2D;
import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.awt.Point;


/*************************************************
 * PQLine is an abstract base for any line that 
 * makes up the outline of a shape.
 * This class allows us to abstract the ArrayList of lines in 
 * the PQShape class, so a shape may contain Arc or Straight
 * lines. 
 * 
 * @author Dan Ward, Chris Walling, Jonathan Dickson 
 *
 */
@XmlTransient
public abstract class PQLine implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7387339090010269485L;
	
	/**
	 * The starting point of the line
	 */
	@XmlJavaTypeAdapter(PointAdapter.class)
	@XmlElement(name="p1")
	protected Point p1;
	
	/**
	 * Then ending point of the line
	 */
	@XmlJavaTypeAdapter(PointAdapter.class)
	@XmlElement(name="p2")
	protected Point p2;
	
	/**
	 * The color the line should be drawn 
	 */
	@XmlJavaTypeAdapter(ColorAdapter.class)
	@XmlAttribute
	protected Color color;
	
	public Color getColor(){
		return color;
	}
	
	public abstract void drawLine(Graphics2D g2);
	public abstract Point getStart();
	public abstract Point getEnd();
	public abstract void setStart(Point start);
	public abstract void setEnd(Point end);
}
